{% extends "base.html" %}

{% block body_attributes %} class="dataBrowser towers"{% endblock %}

{% block content %}
	<h2>Data Browser - Towers</h2>
	<ul class="menu">
	{% for towerType in towerTypes %}
		<li><a href="#{{ towerType.key() }}"><img src="http://image.eveonline.com/InventoryType/{{ towerType.key().id_or_name() }}_64.png" alt="{{ towerType.name }}" /> {{ towerType.name }}</a></li>
	{% endfor %}
	</ul>
	
{% for towerType in towerTypes %}
	<div class="tower" id="{{ towerType.key() }}">
		<h3>{{ towerType.name }}</h3>
		<ul>
			<li>Key: {{ towerType.key() }}</li>
			<li>EVE ID: {{ towerType.key().id_or_name() }}</li>
			<li>Tower Size: {{ towerType.size }}</li>
			<li>Fuel Capacity: {{ '%0d'|format(towerType.fuelCapacity) }} m<sup>3</sup></li>
			<li>Strontium Capacity: {{ '%0d'|format(towerType.strontCapacity) }} m<sup>3</sup></li>
			<li>Base Price: {{ '%0d'|format(towerType.basePrice) }} ISK</li>
			<li>Power Output: {{ '%0d'|format(towerType.powerOutput) }}</li>
			<li>CPU Output: {{ '%0d'|format(towerType.cpuOutput) }}</li>
		</ul>
		<table>
			<caption>Fuel Requirements</caption>
			<thead>
				<tr>
					<th rowspan="2">Fuel Type</th>
					<th rowspan="2">Purpose</th>
					<th colspan="2">High Sec</th>
					<th colspan="2">Low/Null Sec</th>
					<th colspan="2">Sovereignty</th>
				</tr>
				<tr>
					<th>Units</th>
					<th>M<sup>3</sup></th>
					<th>Units</th>
					<th>M<sup>3</sup></th>
					<th>Units</th>
					<th>M<sup>3</sup></th>
				</tr>
			</thead>
			<tbody>
			{% for fuel in towerType.fuel.order('purpose') %}
				<tr>
					<td>{{ fuel.fuelType.name }}</td>
					<td>{{ fuel.purpose }}</td>
					<td>{{ fuel.reqQuantity(sec=0.5) }}</td>
					<td>{{ fuel.reqCubic(sec=0.5) }}</td>
					<td>{{ fuel.reqQuantity(sec=0.0) }}</td>
					<td>{{ fuel.reqCubic(sec=0.0) }}</td>
					<td>{{ fuel.reqQuantity(sov=True) }}</td>
					<td>{{ fuel.reqCubic(sov=True) }}</td>
				</tr>
			{% endfor %}
				<tr>
					<td colspan="2">Optimial Cycles</td>
					<td colspan="2">{{ towerType.optimalCycles(sec=0.5) }}</td>
					<td colspan="2">{{ towerType.optimalCycles(sec=0.0) }}</td>
					<td colspan="2">{{ towerType.optimalCycles(sov=True) }}</td>
				</tr>
				<tr>
					<td colspan="2">Optimial Duration</td>
					<td colspan="2">{{ towerType.optimalDuration(sec=0.5)|secondsFormat }}</td>
					<td colspan="2">{{ towerType.optimalDuration(sec=0.0)|secondsFormat }}</td>
					<td colspan="2">{{ towerType.optimalDuration(sov=True)|secondsFormat }}</td>
				</tr>
			</tbody>
		</table>
		<img src="http://image.eveonline.com/InventoryType/{{ towerType.key().id_or_name() }}_32.png" alt="{{ towerType.name }}" />
		<img src="http://image.eveonline.com/InventoryType/{{ towerType.key().id_or_name() }}_64.png" alt="{{ towerType.name }}" /><br/>
		<img src="http://image.eveonline.com/Render/{{ towerType.key().id_or_name() }}_32.png" alt="{{ towerType.name }}" />
		<img src="http://image.eveonline.com/Render/{{ towerType.key().id_or_name() }}_64.png" alt="{{ towerType.name }}" />
		<img src="http://image.eveonline.com/Render/{{ towerType.key().id_or_name() }}_128.png" alt="{{ towerType.name }}" />
		<img src="http://image.eveonline.com/Render/{{ towerType.key().id_or_name() }}_256.png" alt="{{ towerType.name }}" />
	</div>
{% endfor %} 
{% endblock %}

{% block tail_script %}
<script type="text/javascript">
$(document).ready(function()
{
	$('.tower').hide();
	
	$('ul.menu li a').click(function(e){
		e.preventDefault();
		$('.tower').hide();
		$($(e.target).attr('href')).show();
	});
});
</script>
{% endblock %}